﻿<?php
/**
 * 题目详细界面
 *
 * @author kinet <380511703@qq.com>
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
 */

session_start();
require_once( 'path.php' );
require_once( SOJ_ROOT.'/include/function/lib.php');


$tpl = new my_smarty();

//若未登录,则重定向到登录界面
if( empty($_SESSION['admin']) ){

	$_SESSION['success_message'] = 'do not login yet , '.$_SESSION['admin'];
	header( 'Location:../manager/manager_login.php' );
	exit ;
}
//处理由其他页面保存在会话中的错误信息
if( !empty($_SESSION['errors']) ){

	$tpl->assign( 'errors' , $_SESSION['errors']  );
	//清除之前的错误信息
	unset( $_SESSION['errors'] );
}
$request=$_GET;
if( empty( $request['no']) ){
	header('Location:../manager/manager_login.php');
}else{
	$no = $request['no'];
}
try{
 $db = db_connect();
 $contest = new contest_process( $db ) ;
 $contest->load( 'contest_no' , $no ); 
 $contest_no = $no ;
 $name = $contest->get('name');
 $sign_begin_time = $contest->get('sign_begin_time');
 $sign_end_time = $contest->get('sign_end_time');
 $begin_time = $contest->get('begin_time');
 $end_time = $contest->get('end_time');
 $addtime = $contest->get('addtime');
 $summary=$contest->get('summary');
 $status=$contest->get('status'); 
 $tpl->assign( 'contest_no' , $contest_no );
 $tpl->assign( 'name' , $name );
 $tpl->assign( 'sign_begin_time' , $sign_begin_time );
 $tpl->assign( 'sign_end_time' , $sign_end_time );
 $tpl->assign( 'begin_time' ,$begin_time );
 $tpl->assign( 'end_time' , $end_time );
 $tpl->assign( 'addtime' , $addtime );
 $tpl->assign('summary', $summary);
 $tpl->assign( 'status' , $status );
 $tpl->display('manager_contest_alter.tpl');
}catch(Exception $e){
header('Location:../manager/manager_login.php');
}
